/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package aletex.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;

/**
 *
 * @author cibervn
 */
@Embeddable
public class RolePermissionPK implements Serializable {
    @Basic(optional = false)
    @NotNull
    @Column(name = "RoleID")
    private int roleID;
    @Basic(optional = false)
    @NotNull
    @Column(name = "PermissionID")
    private int permissionID;
    @Basic(optional = false)
    @NotNull
    @Column(name = "ObjectID")
    private int objectID;

    public RolePermissionPK() {
    }

    public RolePermissionPK(int roleID, int permissionID, int objectID) {
        this.roleID = roleID;
        this.permissionID = permissionID;
        this.objectID = objectID;
    }

    public int getRoleID() {
        return roleID;
    }

    public void setRoleID(int roleID) {
        this.roleID = roleID;
    }

    public int getPermissionID() {
        return permissionID;
    }

    public void setPermissionID(int permissionID) {
        this.permissionID = permissionID;
    }

    public int getObjectID() {
        return objectID;
    }

    public void setObjectID(int objectID) {
        this.objectID = objectID;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) roleID;
        hash += (int) permissionID;
        hash += (int) objectID;
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RolePermissionPK)) {
            return false;
        }
        RolePermissionPK other = (RolePermissionPK) object;
        if (this.roleID != other.roleID) {
            return false;
        }
        if (this.permissionID != other.permissionID) {
            return false;
        }
        if (this.objectID != other.objectID) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "aletex.entity.RolePermissionPK[ roleID=" + roleID + ", permissionID=" + permissionID + ", objectID=" + objectID + " ]";
    }
    
}
